﻿/// <reference path="underscore.js" />
(function () {
    var booksArray = [
		{ bookTitle: "HTML5 Programming", author: "O'Reilly" },
		{ bookTitle: "C# Programming", author: "Nakov" },
		{ bookTitle: "Java Programming", author: "Nakov" },
    ];

    var groupedAuthors = _.groupBy(booksArray, function (book) {
        return book.author;
    });

    var authorWithMostBooks = _.max(groupedAuthors, function (book) {
        return book.length
    })[0].author;

    console.log("The author with the most books is: ");
    console.log(authorWithMostBooks);
})();